home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / dcopstub.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.9 KB  |  146 lines

  1. /*
  2. Copyright (c) 1999 Preston Brown <pbrown@kde.org>
  3. Copyright (c) 1999 Matthias Ettrich <ettrich@kde.org>
  4.  
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11.  
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14.  
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  18. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  19. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22.  
  23. #ifndef _DCOPSTUB_H
  24. #define _DCOPSTUB_H
  25.  
  26. class DCOPClient;
  27. class DCOPRef;
  28. class DCOPStubPrivate;
  29.  
  30. #include <stdlib.h>
  31.  
  32. #include <qstring.h>
  33. #include "kdelibs_export.h"
  34.  
  35. /**
  36. * Abstract base class for dcop stubs as created by the
  37. * dcopidl2cpp compiler.
  38. *
  39. */
  40.  
  41. class DCOP_EXPORT DCOPStub
  42. {
  43. public:
  44.     /**
  45.        Creates a DCOPStub for application @p app and object @p obj
  46.        @param app the application id
  47.        @param obj the object id
  48.      */
  49.     DCOPStub( const QCString& app, const QCString& obj );
  50.  
  51.     /** 
  52.       Creates a DCOPStub for application @p app and object @p obj
  53.        that operates on the DCOPClient @p client
  54.        @param client the DCOPClient
  55.        @param app the application id
  56.        @param obj the object id
  57.      */
  58.     DCOPStub( DCOPClient* client, const QCString& app, const QCString& obj );
  59.     
  60.     /**
  61.        Creates a DCOPStub for application ref.app() and object ref.obj()
  62.        @param ref the DCOP reference
  63.      */
  64.     explicit DCOPStub( const DCOPRef& ref );
  65.     virtual ~DCOPStub();
  66.  
  67.     /**
  68.        Return the application id.
  69.        @return the application id
  70.      */
  71.     QCString app() const;
  72.     /**
  73.        Return the object  id.
  74.        @return the object id
  75.      */
  76.     QCString obj() const;
  77.  
  78.     enum Status{ CallSucceeded, CallFailed };
  79.     /**
  80.      * Return the status of the last call, either @p CallSucceeded or
  81.      * @p CallFailed.
  82.      *
  83.      * @return the status of the last call
  84.      * @see ok();
  85.      */
  86.     Status status() const;
  87.  
  88.  
  89.     /**
  90.      * Return whether no error occurred,
  91.      *
  92.      * @return true if the last call was successful, false otherwise
  93.      * @see status();
  94.      */
  95.     bool ok()  const;
  96.  
  97. protected:
  98.  
  99.     /**
  100.        Sets the status to status. Possible values are 'CallSucceeded' and 'CallFailed'
  101.        @param _status the new status
  102.        @see status()
  103.      */
  104.     void setStatus( Status _status );
  105.  
  106.     /**
  107.       Invoked whenever a call fails.  The default implementation
  108.       sets the status to CallFailed.
  109.      */
  110.     virtual void callFailed();
  111.     
  112.     /** 
  113.       The dcopClient this stub operates on. Either the specific one
  114.        specified in the constructor or DCOPClient::mainClient.
  115.        @return the stub's DCOPClient
  116.     */
  117.     DCOPClient* dcopClient();
  118.  
  119.     /**
  120.      * @internal
  121.      * Never use. Used only for default ctors of inherited stubs,
  122.      * because of the way ctors of virtual base classes work.
  123.      * Otherwise dcopidl2cpp would have to call ctors of all, even
  124.      * indirect, bases.
  125.      * @since 3.1
  126.      */
  127.     enum never_use_t { never_use };
  128.     /**
  129.      * @internal
  130.      * @since 3.1
  131.      */
  132.     DCOPStub( never_use_t ) { abort(); }
  133.     
  134. private:
  135.     QCString m_app;
  136.     QCString m_obj;
  137.     Status m_status;
  138.  
  139. protected:
  140.     virtual    void virtual_hook( int id, void* data );
  141. private:
  142.     DCOPStubPrivate *d;
  143. };
  144.  
  145. #endif
  146.